<template>
  <u-collapse
    ref="collapse"
    :head-style="{ 'font-size': '34rpx', 'font-weight': '700' }"
  >
    <u-collapse-item :title="title">
      <view
        class="collapse-item-box"
        v-for="(item, index) in ListArr"
        :key="index"
        @click="goDetail(item.topic.id)"
      >
        <view>
          <text>{{ item.author.loginname }}</text>
          在话题
        </view>
        <view class="title-box">
          <text>{{ item.topic.title }}</text>
          中@了你
        </view>
      </view>
      <u-empty v-if="list.length === 0" text="暂无数据" mode="list"></u-empty>
    </u-collapse-item>
  </u-collapse>
</template>

<script>
import { goDetail } from "@/utils/jump.js";
export default {
  props: {
    list: {
      type: Array,
      default: () => [],
    },
    title: {
      type: String,
    },
  },
  data() {
    return {
      goDetail,
    };
  },
  computed: {
    ListArr() {
      console.log(this.list);
      this.$nextTick(() => {
        this.$refs.collapse.init();
      });
      return this.list;
    },
  },
};
</script>

<style lang="scss" scoped>
.collapse-item-box {
  padding: 20rpx 0;
  border-bottom: 1px solid #ccc;
  color: #000;
  text {
    color: #3182bd;
  }
}
.title-box {
  margin-top: 20rpx;
  text-align: right;
}
</style>